package org.example.partnerbacked.test;


import org.example.partnerbacked.common.ErrorCode;
import org.example.partnerbacked.exception.BusinessException;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.test.context.junit4.SpringRunner;

import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date;

import static java.lang.Thread.sleep;


@SpringBootTest
public class test {

    @Autowired
    private RedisTemplate redisTemplate;
    @Test
    public void test(){

        System.out.println(redisTemplate);
        ValueOperations valueOperations =redisTemplate.opsForValue();
        valueOperations.set("yupiString", "dog");
        valueOperations.set("yupiInt", 1);
        valueOperations.set("yupiDouble", 2.0);
        // 查
        Object yupi = valueOperations.get("yupiString");
        yupi = valueOperations.get("yupiInt");
        yupi = valueOperations.get("yupiDouble");
        System.out.println(yupi);
        System.out.println(valueOperations.get("yupiUser"));
        valueOperations.set("yupiString", "dog");
        redisTemplate.delete("yupiString");
    }

    public static void main(String[] args) throws InterruptedException {
        Date date = new Date();
        System.out.println(date);
        LocalTime localTime= LocalTime.now();
        sleep(1000);
        LocalTime localTime1 = LocalTime.now();
        System.out.println(localTime);
        boolean b=localTime1.isBefore(localTime);
        System.out.println(b);
    }
}
